package pingan.com.quarter_hour.adpater;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import pingan.com.quarter_hour.R;
import pingan.com.quarter_hour.bean.ZDuanziItem;

/**
 * Created by wk on 2018/1/15.
 */
public class ZCrossTalkAdapter extends RecyclerView.Adapter<ZCrossTalkAdapter.ViewHolder> {
    Context context;
    List<ZDuanziItem.DataBean> list;

    public ZCrossTalkAdapter(Context context, List<ZDuanziItem.DataBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View inflate = View.inflate(context, R.layout.cross_talk_item, null);
        ViewHolder viewHolder = new ViewHolder(inflate);

        return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        ViewHolder viewHolder=holder;
        viewHolder.mCrossTalkUserImage.setImageURI(list.get(position).getImgUrls());
        viewHolder.mCrossTalkUserName.setText(list.get(position).getContent());
        viewHolder.mCrossTalkUserCreatetime.setText(list.get(position).getCreateTime());

    }


    @Override
    public int getItemCount() {
        return list.size();
    }



    class ViewHolder extends RecyclerView.ViewHolder{
        @BindView(R.id.cross_talk_user_image)
        SimpleDraweeView mCrossTalkUserImage;
        @BindView(R.id.cross_talk_user_name)
        TextView mCrossTalkUserName;
        @BindView(R.id.cross_talk_user_createtime)
        TextView mCrossTalkUserCreatetime;


        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
